package stud.aistar.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import stud.aistar.service.IDoctorService;
import stud.aistar.service.ISecondDepartmentService;
import stud.aistar.service.ITimeService;

/**
 * Created by Jcdz on 2019/10/12.
 */
@Controller
public class SendDataController {
    @Autowired
    private IDoctorService doctorService;

    @Autowired
    private ISecondDepartmentService secondDepartmentService;

    @Autowired
    private ITimeService timeService;

    @RequestMapping("/sendata")
    public String sendData(String did, String sid, String tid, Model model){

//        Doctor doctor = doctorService.findById(Integer.valueOf(did));
//
//        SecondDepartment secondDepartment = secondDepartmentService.findById(Integer.valueOf(sid));
//
//        Time time = timeService.findById(Integer.valueOf(tid));
//
//        model.addAttribute("doctor",doctor);
//
//        model.addAttribute("secondDepartment",secondDepartment);
//
//        model.addAttribute("time",time);

        Integer deptId = secondDepartmentService.findDeptIdById(Integer.valueOf(sid));

        model.addAttribute("did",did);
        model.addAttribute("fid",deptId);
        model.addAttribute("sid",sid);
        model.addAttribute("tid",tid);


        return "reg/regOffice";
    }
}
